nums = list(map(int, input().split()))
length = len(nums)
bucket = [0]*1001
ptr = -1


def chain(numlist: list, top: int) -> int:
    tmpSum = 0
    i = top
    while i > 0 and tmpSum < numlist[top]:
        i -= 1
        tmpSum += numlist[i]

    if tmpSum == numlist[top]:
        numlist[i] = numlist[top] << 1
        top = i
        top = chain(numlist, top)

    return top


for i in range(length):
    ptr += 1
    bucket[ptr] = nums[i]
    ptr = chain(bucket, ptr)
ans = bucket[:ptr+1]
ans = ans[::-1]
print(ans)
